import * as vscode from 'vscode'

export interface RecordData {
  id: number
  problem: string
  solution: string
  filePath: string
  codeSnippet: string
  lineRange: string
  createdAt: string
  workspacePath: string
  tags?: string[]
}

export interface RecordFormData {
  problem: string
  solution: string
  filePath: string
  codeSnippet: string
  lineRange: string
  tags?: string[]
}

export interface TagConfig {
  maxTags: number
  maxTagLength: number
  allowedCharacters?: RegExp
}

export interface TagInputProps {
  initialTags?: string[]
  placeholder?: string
  maxTags?: number
  onTagsChange?: (tags: string[]) => void
}

export interface WebviewMessage {
  command: string
  data?: any
}

export interface CodeLensData {
  recordId: number
  range: vscode.Range
}

export interface RecordComment {
  recordId: number
  filePath: string
  line: number
  prefix: string
}

// 默认标签配置
const DEFAULT_TAG_CONFIG: TagConfig = {
  maxTags: 6, // 最多6个标签
  maxTagLength: 20, // 单个标签最多20字符
  allowedCharacters: /^[\u4e00-\u9fa5a-zA-Z0-9_-]+$/ // 中文、英文、数字、下划线、连字符
}
